package net.zjitc.service;

import net.zjitc.dao.BrandDao;
import net.zjitc.models.Brand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("brandService")
public class BrandService {


    @Autowired
    private    BrandDao brandDao;


    public List<Brand> find_all(){
        return brandDao.find_all();
    }

    public int create(String name,String tag){
        Brand brand=new Brand();
        brand.setTag(tag);
        brand.setName(name);
        return brandDao.create(brand);
    }

    public int update(String name,String tag){
        Brand brand=new Brand();
        brand.setTag(tag);
        brand.setName(name);
        return brandDao.update(brand);
    }

    public int delete(int id){
        return brandDao.delete(id);

    }
}
